<?php

declare (strict_types=1);
/*
 * This file is part of Leonsw.
 *
 * @link     https://leonsw.com
 * @document https://docs.leonsw.com
 * @contact  leonsw.com@gmail.com
 * @license  https://leonsw.com/LICENSE
 */
namespace App\Models\MainDB\BlindBox;

use App\Models\MainDB\Gift;
use Illuminate\Database\Eloquent\Model;
/**
 * @property int $id 
 * @property int $user_id 
 * @property int $draw_id 
 * @property int $prize_id 
 * @property int $prize_price 
 * @property int $count 
 * @property \Carbon\Carbon $created_at 
 * @property \Carbon\Carbon $updated_at 
 */
class DrawRecord extends Model
{
    protected $table = 'ln_blind_box_draw_record';
    //protected $fillable = [];
    protected $guarded = [];
    protected $casts = ['id' => 'int', 'user_id' => 'integer', 'draw_id' => 'integer', 'gift_id' => 'integer', 'count' => 'integer', 'created_at' => 'datetime', 'updated_at' => 'datetime'];

    public function getDateFormat()
    {
        return 'Y-m-d H:i:s.u';
    }

    public function gift()
    {
        return $this->hasOne(Gift::class, 'id', 'prize_id');
    }

    public function user()
    {
        return $this->hasOne(User::class, 'id', 'user_id');
    }
}